package repository;



import java.util.ArrayList;
import java.util.Hashtable;

import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;

/**
 * Handler for parsing of music xml files within repository, more info in sax documentation.
 * @author 0800542m
 *
 */
public class ParseHandler implements ContentHandler{
	
	//Music for each instrument is added to this hashtable as they are parsed.
	private Hashtable<Integer, ArrayList<Note>> musicResults;
	
	//Length of song.
	private int sLength;
	
	
	//Constructor
	protected ParseHandler(){
		musicResults = new Hashtable<Integer, ArrayList<Note>>();
	}
	
	
	//Methods used by package
	protected Hashtable<Integer, ArrayList<Note>> getMusicResults(){
		return musicResults;
	}
	
	protected int getSongLength(){
		return sLength;
	}

	
	//Private methods
	@Override
	public void setDocumentLocator(Locator locator) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void startDocument() throws SAXException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void endDocument() throws SAXException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void startPrefixMapping(String prefix, String uri)
			throws SAXException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void endPrefixMapping(String prefix) throws SAXException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void startElement(String uri, String localName, String qName,
			Attributes atts) throws SAXException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void endElement(String uri, String localName, String qName)
			throws SAXException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void characters(char[] ch, int start, int length)
			throws SAXException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void ignorableWhitespace(char[] ch, int start, int length)
			throws SAXException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void processingInstruction(String target, String data)
			throws SAXException {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void skippedEntity(String name) throws SAXException {
		// TODO Auto-generated method stub
		
	}

}
